repo.or.cz
/
and.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
147 - Dollars (Programación dinámica, DP, coin change)
[and.git]
/
11335 - Discrete pursuit
/
11335.2.cpp
blob
2635188c8bb3c43f8417444b00bbb6699f336b7b
1
#include <iostream>
2
3
using namespace
std
;
4
5
int
main
(){
6
unsigned int
a
,
u
,
v
;
7
while
(
cin
>>
a
>>
u
>>
v
){
8
if
(
a
==
0
){
9
cout
<<
"0"
<<
endl
;
10
}
else
{
11
unsigned int
min
,
px
,
lx
,
py
,
ly
,
t
;
12
px
=
0
;
13
lx
=
a
;
14
t
=
0
;
15
while
(
px
<
lx
){
16
++
t
;
17
px
+=
t
;
18
lx
+=
u
;
19
}
20
min
=
t
;
21
22
py
=
1
;
23
ly
=
v
;
24
t
=
1
;
25
while
(
py
<
ly
){
26
++
t
;
27
py
+=
t
;
28
ly
+=
v
;
29
}
30
31
if
(
t
>
min
)
min
=
t
;
32
cout
<<
min
<<
endl
;
33
}
34
}
35
return
0
;
36
}